1. Field of the Invention
The present invention relates to a data processor, and more specifically to a data processor functioning as a pulse generator which receives a clock from a peripheral equipment and generates a pulse for controlling the peripheral equipment.
2. Description of Related Art
A pulse generator realized by a data processor and receiving a clock from a peripheral equipment for generating a pulse controlling the peripheral equipment has been widely used for various real-time peripheral equipment controls, for example automobile engine controls.
A pulse generator realized by a data processor basically comprises a central processing unit, an interrupt controller for generating an interrupt request to the central processing unit, and a peripheral device for generating an interrupt signal to the interrupt controller. The peripheral device includes a free-running counter for counting an internal clock, and a compare register for comparing a .count value of the free-running counter with a value set in the compare register itself. The peripheral device also includes an event counter for counting an external clock, and another compare register for comparing a count value of the event counter with a value set in the compare register itself. A flipflop is set when the second compare register detects coincidence, and reset when the first compare register detects coincidence, so that the flipflop generates a pulse signal having a desired predetermined pulse width in synchronism with the external clock.
However, the conventional pulse generator has been disadvantageous in the following point: If the repetition period of the external clocks becomes short to the extent that the repetition period of equal signals generated by the compare register coupled to the event counter becomes shorter than the desired predetermined pulse width of the pulse signal to be generated by the flipflop, the pulse signal is reset although the pulse signal should be maintained at a high level. For example, if the pulse generator is used for a fuel injection control of an automobile engine, when fuel should be continued to be injected, the pulse signal is suddenly reset so that the fuel injection is suddenly stopped.